<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title><%-title%></title>
</head>
<body>
    <h1><%-title%></h1>
</body>
<input type="file" id="upload">
<script>
    const input = document.getElementById('upload')
    input.addEventListener('change',function(e){
        const file = input.files[0]
        const formData = new FormData()
        formData.append('file',file)
        console.log('formData', formData)
        fetch('http://localhost:7001/api/upload',{
            method: 'POST',
            body: formData
        }).then(res=>{
            if(res.ok) {
                console.log('success')
                return res.json()
            }else{
                console.log('error')
            }
        }).then(res=>{
            console.log('res is',res)
        })
    })
</script>
</html>